home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 117
/
FreelogNo117-OctobreNovembre2013.iso
/
Programmation
/
jedit
/
jedit5.1.0install.exe
/
{app}
/
jars
/
QuickNotepad.jar
/
changes40.txt
< prev
next >
Wrap
Text File
|
2012-05-31
|
5KB
|
100 lines
$Id$
Changes made to QuickNotepad plugin for jEdit 4.0:
(1) Under jEdit 3.2.2 and prior versions, the plugin had a separate class,
QuickNotepadDockable, implementing the DockableWindow interface. The class's
methods delegated actions to the plugin's top-level visible component, a class
derived from JPanel called QuickNotepad. The DockableWindow interface is
deprecated in jEdit 4.0, so this class was eliminated. If the top-level
component had implemented the DockableWindow interface, it would have been
necessary to remove DockableWindow as an implemented interface and the eliminate
the getName() and getComponent() methods of that interface in the plugin class.
(2) A new file, dockables.xml, was created containing XML markup for the
constructor of a plugin component. Under the new plugin API, this file is read
to determine the method call or calls for constructing a new instance of a
dockable plugin component. The file is quite short:
<?xml version="1.0"?>
<!DOCTYPE DOCKABLES SYSTEM "dockables.dtd">
<!-- QuickNotepad dockable window -->
<DOCKABLES>
<DOCKABLE NAME="quicknotepad">
new QuickNotepad(view, position);
</DOCKABLE>
</DOCKABLES>
The parameters are those found in the existing version of the QuickNotepad
constructor. Both "view" and "position" are defined by the new plugin API in the
namespace in which the constructor is called. The value of position is taken
from optional properties set by the user. In the absence of a user setting, the
position parameter is set to place the plugin component in a floating window.
The NAME attribute is taken to conform to the value of the static variable
QuickNotepadPlugin.NAME, which is also used to identify the plugin in the user
action code contained in actions.xml.
By default, the plugin API adds two actions for a plugin. The first is entitled
[name of plugin] (in this case, "quicknotepad"), and simply activates the plugin
by executing the code contained in the DOCKABLE element. The second action
toggles the plugin's visible component, the title of the action is [name of
plugin]-toggle (in this case, "quicknotepad-toggle"). The plugin API handles
this action internally.
To prevent these actions from being created, you can add a NO_ACTIONS="true"
attribute to the DOCKABLE element. The NAME and NO_ACTIONS attributes are the
only attributes defined for a DOCKABLE entry. A NAME is required; NO_ACTIONS is
set to "false" by default.
(3) In the actions.xml file, the user action definitions were revised to call
DockableWindowManager.getDockable() instead of
DockableManager.getDockableWindow(). In addition, the actions for toggling the
plugin docking window and bringing the QuickNotepad window to the foreground
were eliminated. The toggle action was duplicative of the built-in action
supplied through dockables.xml, and the "bring to front" action had become
redundant.
(4) There were two deletions made in QuickNotepadPlugin, the main plugin class.
The handleMessage() method was eliminated because it was only necessary for the
plugin to listen for the CreateDockableWindow message. As a result, it is no
longer necessary for this plugin to connect to the EditBus, so its derivation
was changed from EBPlugin to EditPlugin. Individual instances of the
QuickNotepad class still need to listen for a PropertiesChanged message, so that
class continues to implement EBComponent.
In addition, since the EditBus no longer maintains an active list of windows,
the call to EditBus.addToNamedList() is no longer needed in the class's start()
method and so was eliminated, leaving an empty start() method.
(5) No changes were required in the option pane class, QuickNotepadOptionsPane,
or the other other classes defining components of the plugin.
(6) Finally, several changes were made to the propoerties file of the plugin,
QuickNotepad.props. First, the plugin's dependency properties were changed to
make the plugin dependent upon version 4.0 or greater of jEdit:
plugin.QuickNotepadPlugin.depend.1=jedit 04.00.00.00
Next, the quicknotepad.title property was eliminated, and the "label" properties
for the docking window and plugin menu were reorganized into two categories:
labels for action created by dockable.xml (quicknotepad.label and
quicknotepad-toggle.label), and labels for actions created by actions.xml (the
remaining user actions: "choose-file", "save-file" and "copy-to-buffer").
The plugin was built using the standard build.xml supplied for plugins,
after checking to make sure that the name of the plugin and the location of
jedit.jar were correct. It was also necessary to add dockables.xml to the list
of files to be archived by the jar utility. Iterations of the build process
helped to uncover deprecated API elements.
The help file was built from DocBook XML source using xsltproc. The build.xml
Ant build file and the users-guide.xsl customization file contain annotations
which may be helpful in building plugin documentation. In particular, a few
<indexterm> tags were added to the documentation source to provide references
for the index to be generated for all plugin files.